# How the Maintained push button works at run time

This button works like a hard-wired switch. When the operator first presses the button, it changes from State 0 to State 1 and sends the State 1 value to the data source. When the operator presses and releases the button a second time, it changes from State 1 back to State 0 and sends the State 0 value to the data source.

The Maintained push button’s behavior at run time also depends on how you set up the Next state based on option and controls.

## Change states

- The application uses the Next state based on option (specified on the General tab of the Maintained Push Button dialog box) to determine how to change the button’s state.

  Example: Using a Maintained push button

- If Next state based on is set to Value connection, and the control’s value does not match either state’s value, the button is set to State 0 and the application writes the State 0 value to the data source.

## Use controls

- If you assign just the Value connection and not the Indicator connection, the button’s state is shown as soon as the button is pressed. The feedback for this connection is local and immediate. It does not necessarily reflect the Value connection’s value in the data source.
- If you assign the same tag to the Value and Indicator controls, at run time the shown button state is based on the Indicator connection. If network traffic is heavy, the display response might be delayed.
- If the Indicator connection value is a floating point value, the application rounds the value to the nearest integer to determine the state to display.

## Start projects

When your display is opened at run time, the application reads the Value connection and sets the button to the state for that value, regardless of the Next state based on setting.

## Open graphic displays

- When you open a display at run time, the application reads the button’s Value connection and sets the button to the state for that value. If the Indicator connection is not assigned, the shown state is based on this value.
- When you open a display at run time, the application reads the Indicator connection value and updates the display based on the value.

  If the value does not match either state’s value, the error state is shown. When the operator presses the button, it changes to State 0.

## See also

Causes of run-time errors for the Maintained push button

About the Maintained push button's error state

Set up controls for the Maintained push button

Configure the Maintained push button

Example: Use a Maintained push button